* June 13, 2025

 set matsize 500
 set more off
 
use "C:\0. replication, based on Kenwick and Vasquez, 2017, JOP, paper\replication based on K&V, 2017, JOP\data collections_Kenwick and Vasquez, 2017, JOP\jl_modified2.dta", clear


sort year

 
*** Appendix 1

corr dispute fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo



*** Table 2 *** 

*Model 1
logit dispute fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	peaceyrs peaceyrs2 peaceyrs3 /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	, cluster(ddyad)
	est store mod1
*Model 2
logit dispute fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	peaceyrs peaceyrs2 peaceyrs3 /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year<1946, cluster(ddyad)
	est store mod2
*Model 3
logit dispute fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	peaceyrs peaceyrs2 peaceyrs3 /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year>1945, cluster(ddyad)
est store mod3

*Model 4
logit dispute fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	peaceyrs peaceyrs2 peaceyrs3 /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	, cluster(ddyad)
listcoef, st help
*Model 5
logit dispute fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	peaceyrs peaceyrs2 peaceyrs3 /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year<1946, cluster(ddyad)
listcoef, st help
*Model 6
logit dispute fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	peaceyrs peaceyrs2 peaceyrs3 /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year>1945, cluster(ddyad)
listcoef, st help


*** War is the DV
tsset ddyad year, yearly
sort year
* war, create variable for time since last event
sort ddyad year
by ddyad: generate time1 = cond(_n>1, war[_n-1], 0)
by ddyad: generate time2 = sum(time1)
generate yearspeacew = .
sort ddyad time2
by ddyad time2: replace yearspeacew= (year - year[1])+1
drop time1 time2
/* create cubic polynomial of time/100 */
generate yearout1w = yearspeacew
generate yearout2w =  yearspeacew^2
generate yearout3w =  yearspeacew^3


*** Appendix 2

corr war fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo


*** Table 2 *** 

*Model 7
logit war fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	, cluster(ddyad)
	est store mod4
*Model 8
logit war /*fbdef*/ nfbdef pchaloff ///
 	pchalneu ln_distance capprop /*jdem*/ s_un_glo ///
	yearout1w yearout2w yearout3w  /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year<1946, cluster(ddyad)
	est store mod5
*Model 9
logit war fbdef nfbdef /*pchaloff*/ ///
 	/*pchalneu*/ ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w  /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year>1945, cluster(ddyad)
est store mod6
esttab mod*, b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) stats(N ll r2) keep(fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo _cons) 
estimates clear



*** Figure 1 ***

logit war fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	, cluster(ddyad)
    margins, dydx(*) post
	est store mod4
logit war /*fbdef*/ nfbdef pchaloff ///
 	pchalneu ln_distance capprop /*jdem*/ s_un_glo ///
	yearout1w yearout2w yearout3w  /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year<1946, cluster(ddyad)
    margins, dydx(*) post
	est store mod5
logit war fbdef nfbdef /*pchaloff*/ ///
 	/*pchalneu*/ ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w  /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year>1945, cluster(ddyad)
margins, dydx(*) post
est store mod6
coefplot (mod4, label(Model 7) pstyle(p1) msymbol(D)) (mod5, label(Model 8) pstyle(p4) msymbol(Sh)) (mod6, label(Model 9) pstyle(p5) msymbol(T)), /*drop(_cons)*/ keep(fbdef nfbdef) xline(0) /*xtitle(Average Substantive Effects)*/ ///
         order(fbdef nfbdef) ///
         coeflabel(fbdef = "Target has a defense alliance from birth" nfbdef  = "Target has a defense alliance formed after birth") ///
         levels(80 80 80)
estimates clear



*** Table 3 ***

relogit war fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	, 
	est store mod1
relogit war /*fbdef*/ nfbdef pchaloff ///
 	pchalneu ln_distance capprop /*jdem*/ s_un_glo ///
	yearout1w yearout2w yearout3w  /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year<1946, 
	est store mod2
relogit war fbdef nfbdef /*pchaloff*/ ///
 	/*pchalneu*/ ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w  /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year>1945, 
est store mod3

gen majpower = 1 if (challenger == 2 | challenger == 200 | challenger == 220 | challenger == 365 | challenger == 710) /* US, UK, France, Russia, China */ 
replace majpower = 0 if majpower == .

logit war fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if majpower == 1 | contig == 1, cluster(ddyad)
	est store mod4
logit war /*fbdef*/ nfbdef pchaloff ///
 	pchalneu ln_distance capprop /*jdem*/ s_un_glo ///
	yearout1w yearout2w yearout3w  /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year<1946 & (majpower == 1 | contig == 1), cluster(ddyad)
	est store mod5
logit war fbdef nfbdef /*pchaloff*/ ///
 	/*pchalneu*/ ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w  /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if year>1945 &  (majpower == 1 | contig == 1), cluster(ddyad)
est store mod6
esttab mod*, b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) stats(N ll r2) keep(fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo _cons) 
estimates clear



*** Table 4 ***

heckprob war                fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem /*s_un_glo*/ yearout1w yearout2w yearout3w, ///
         select(dispute =   fbdef nfbdef ptargdef pchalally pchaloff pchalneu ln_distance capprop jdem s_un_glo peaceyrs peaceyrs2 peaceyrs3) cluster(ddyad) nolog
est store mod1
heckprob war                fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem /*s_un_glo*/ yearout1w yearout2w yearout3w if year<1946, ///
         select(dispute =   fbdef nfbdef ptargdef pchalally pchaloff pchalneu ln_distance capprop jdem s_un_glo peaceyrs peaceyrs2 peaceyrs3) cluster(ddyad) nolog
est store mod2
heckprob war                fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem /*s_un_glo*/ yearout1w yearout2w yearout3w if year>1945, ///
         select(dispute =   fbdef nfbdef ptargdef pchalally pchaloff pchalneu ln_distance capprop jdem s_un_glo peaceyrs peaceyrs2 peaceyrs3) cluster(ddyad) nolog
est store mod3
esttab mod*, b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) stats(N ll r2) keep(fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo _cons)
estimates clear



*** Figure 2 ***

*** MIDs escalated to Wars: Substantive Effects

heckprob war                fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem /*s_un_glo*/ yearout1w yearout2w yearout3w, ///
         select(dispute =   fbdef nfbdef ptargdef pchalally pchaloff pchalneu ln_distance capprop jdem s_un_glo peaceyrs peaceyrs2 peaceyrs3) cluster(ddyad) nolog
margins, dydx(*) post
est store mod1
heckprob war                fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem /*s_un_glo*/ yearout1w yearout2w yearout3w if year<1946, ///
         select(dispute =   fbdef nfbdef ptargdef pchalally pchaloff pchalneu ln_distance capprop jdem s_un_glo peaceyrs peaceyrs2 peaceyrs3) cluster(ddyad) nolog
margins, dydx(*) post
est store mod2
heckprob war                fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem /*s_un_glo*/ yearout1w yearout2w yearout3w if year>1945, ///
         select(dispute =   fbdef nfbdef ptargdef pchalally pchaloff pchalneu ln_distance capprop jdem s_un_glo peaceyrs peaceyrs2 peaceyrs3) cluster(ddyad) nolog
margins, dydx(*) post
est store mod3
coefplot (mod1, label(Model 1) pstyle(p1) msymbol(D)) (mod2, label(Model 2) pstyle(p4) msymbol(Sh)) (mod3, label(Model 3) pstyle(p5) msymbol(T)), /*drop(_cons)*/ keep(fbdef nfbdef) xline(0) /*xtitle(Average Substantive Effects)*/ ///
         order(fbdef nfbdef) ///
         coeflabel(fbdef = "Target has a defense alliance from birth" nfbdef  = "Target has a defense alliance formed after birth") ///
         levels(80 80 80)
estimates clear



*** Table 5

heckprob war                fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo /*yearout1w yearout2w yearout3w*/, ///
         select(dispute =   fbdef nfbdef ptargdef pchalally pchaloff pchalneu ln_distance capprop jdem s_un_glo peaceyrs peaceyrs2 peaceyrs3) cluster(ddyad) nolog
est store mod1
heckprob war                fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo /*yearout1w yearout2w yearout3w*/ if year<1946, ///
         select(dispute =   fbdef nfbdef ptargdef pchalally pchaloff pchalneu ln_distance capprop jdem s_un_glo peaceyrs peaceyrs2 peaceyrs3) cluster(ddyad) nolog
est store mod2
heckprob war                fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo /*yearout1w yearout2w yearout3w*/ if year>1945, ///
         select(dispute =   fbdef nfbdef ptargdef pchalally pchaloff pchalneu ln_distance capprop jdem s_un_glo peaceyrs peaceyrs2 peaceyrs3) cluster(ddyad) nolog
est store mod3
esttab mod*, b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) stats(N ll r2) keep(fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo _cons)
estimates clear



*** Table 6 ***

logit war fbdef nfbdef pchaloff ///
 	pchalneu ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if dispute == 1, cluster(ddyad)
	est store mod4
keep if year>1945 
logit war fbdef nfbdef /*pchaloff*/ ///
 	/*pchalneu*/ ln_distance capprop jdem s_un_glo ///
	yearout1w yearout2w yearout3w  /*yr7 yr12 yr28 yr33-yr34 yr36 yr38 yr41 yr44-yr46 yr48 yr50 yr55 yr61 yr63 yr68 yr70 yr78-yr79 yr81 yr83 yr85 yr88 yr91 yr94 yr96-yr97 yr99 ///
	                             yr104-yr105 yr114 yr116 yr119 yr123-yr129 yr133 yr135 yr140 yr46 yr149-yr152 yr154 yr156 yr159-yr160 yr162-yr163 yr165 yr167 yr171 yr177-yr178*/ ///
	if dispute == 1, cluster(ddyad)
est store mod6
esttab mod*, b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) stats(N ll r2) keep(fbdef nfbdef pchaloff pchalneu ln_distance capprop jdem s_un_glo _cons) 
estimates clear




